package com.dk.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dk.entity.DtSpecification;
import com.dk.mapper.DtSpecificationMapper;
import com.dk.service.IDtSpecificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 规格表 服务实现类
 * </p>
 *
 * @author author
 * @since 2021-12-22
 */
@Service
public class DtSpecificationServiceImpl implements IDtSpecificationService {

    @Autowired
    private DtSpecificationMapper mapper;

    @Override
    public IPage<DtSpecification> getSpecs(Integer pageNum, Integer pageSize) {
        LambdaQueryWrapper<DtSpecification> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        IPage<DtSpecification> page = new Page<>(pageNum,pageSize);
        IPage<DtSpecification> page1 = mapper.selectPage(page, lambdaQueryWrapper);

        return page1;
    }

    @Override
    public void add(DtSpecification spec) {
        mapper.insert(spec);
    }

    @Override
    public void delete(Long id) {
        mapper.deleteById(id);
    }

    @Override
    public void update(DtSpecification spec) {
        mapper.updateById(spec);
    }
}
